<html>

<head>
    <title>无线传感器web管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" />
    <link rel="stylesheet" href="../../css/font_icon.css" type="text/css" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <style>
        html {
            overflow-y: hidden;
        }

        .nav_pc {
            position: absolute;
            width: 200px;
            height: 100%;
            background-color: #fff;
        }

        .nav_phone {
            position: absolute;
            width: 50px;
            background-color: #fff;
        }

        .right {
            position: absolute;
            left: 200px;
            right: 0px;
            top: 0;
            bottom: 0;
        }

        .nav_list_ul {
            padding-left: 35px;
            line-height: 45px;
        }

        .nav_list_ul-phone {
            padding-left: 15px;
        }

        .nav_list_ul-active {
            color: #fff;
            background-color: #b13a41;
        }

        .nav_list_ul:hover {
            color: #fff;
            background-color: #b13a41;
        }

        .nav_img img {
            margin-top: 40px;
            margin-left: 20px;
            margin-bottom: 40px;
            width: 150px;
        }

        .icon {
            position: relative;
            top: 2px;
            margin-right: 5px;
            font-size: 22px;
        }

        .arrows {
            position: relative;
            margin-right: 20px;
            top: 2px;
            font-size: 6px;
            float: right;
        }

        .arrows-active {
            transform: rotate(90deg);
        }

        .child {
            padding-left: 50px;
        }

        .nav_pc {
            z-index: 999;
        }

        .header_pc{
                height: 110px;
            }

        /* phone */
        @media screen and (max-width:1200px) {
            body::after {
                content: "phone";
                font-size: 0;
            }

            .right {
                left: 50px;
            }

            .body_phone {
                /* display: block; */
                position: relative;
                top:0;
                left:0;
            }

            .body_pc {
                /* display: none; */
                position:fixed; 
                top:-9999px;
                left:-9999px;
            }

            .nav_pc {
                display: none;
            }

            .nav_phone {
                display: block;
            }
        }

        /* pc */
        @media screen and (min-width:1200px) {
            body::after {
                content: "pc";
                font-size: 0;
            }

            /* position:fixed; top:-9999px;left:-9999px; */

            .right {
                left: 200px;
            }

            .body_phone {
                /* display: none; */
                position:fixed; 
                top:-9999px;
                left:-9999px;
            }

            .body_pc {
                /* display: block; */
                position: relative;
                top:0;
                left:0;
            }

            .nav_pc {
                display: block;
            }

            .nav_phone {
                display: none;
            }
        }

        .shade {
            display: none;
            position: fixed;
            width: 100%;
            height: 100%;
            background: dimgrey;
            bottom: 0px;
            left: 0px;
            background-color: rgba(0, 0, 0, .5);
            z-index: 998;
        }
    </style>
</head>


<body>


    <div onclick="closeNav()" class="shade"></div>

    <div class="left">
        <div class="nav_pc">
            <div class="nav_img">
                <img src="../../img/logo.225bb361.png">
            </div>
            <li class="nav_list">
                <ul class="nav_list_ul nav_list_ul-active">
                    <span class="iconfont icon">&#xe8b9;</span>首页<span class="iconfont arrows">&#xe62d;</span>
                </ul>
                <ul onclick="btn(1)" class="nav_list_ul">
                    <span class="iconfont icon">&#xe60c;</span>节点1<span class="iconfont arrows" id="s1">&#xe62d;</span>
                </ul>
                <ul class="nav_list" id="u1" style="display:none">
                    <li class="nav_list_ul child">环境信息</li>
                    <li class="nav_list_ul child">实时监控</li>
                    <li class="nav_list_ul child">历史照片</li>
                    <li class="nav_list_ul child">远程控制</li>
                </ul>
                <ul onclick="btn(2)" class="nav_list_ul">
                    <span class="iconfont icon">&#xe60c;</span>节点2<span class="iconfont arrows" id="s2">&#xe62d;</span>
                </ul>
                <ul class="nav_list" id="u2" style="display:none">
                    <li class="nav_list_ul child">环境信息</li>
                    <li class="nav_list_ul child">实时监控</li>
                    <li class="nav_list_ul child">历史照片</li>
                    <li class="nav_list_ul child">远程控制</li>
                </ul>
                <ul class="nav_list_ul">
                    <span class="iconfont icon">&#xe8b7;</span>设置管理<span class="iconfont arrows">&#xe62d;</span>
                </ul>
            </li>
        </div>

        <div onclick="showNav()" class="nav_phone">
            <div class="nav_img">
                <img src="../../img/logo.225bb361.png">
            </div>
            <li class="nav_list">
                <ul class="nav_list_ul nav_list_ul-active nav_list_ul-phone">
                    <span class="iconfont icon">&#xe8b9;</span>
                </ul>
                <ul class="nav_list_ul nav_list_ul-phone">
                    <span class="iconfont icon">&#xe60c;</span>
                </ul>
                <ul class="nav_list_ul nav_list_ul-phone">
                    <span class="iconfont icon">&#xe60c;</span>
                </ul>
                <ul class="nav_list_ul nav_list_ul-phone">
                    <span class="iconfont icon">&#xe8b7;</span>
                </ul>
            </li>
        </div>
    </div>

    <div class="right">
        <div class="right_body">
            <iframe class="header" type="text/html" src="../../components/header_pc.html"></iframe>
            <iframe class="body_pc" type="text/html" src="./body_pc.html"></iframe>
            <iframe class="body_phone" type="text/html" src="./body_phone.html"></iframe>
        </div>
    </div>

    <script>
        const nav_pc = document.getElementsByClassName("nav_pc")[0];
        const shade = document.getElementsByClassName("shade")[0];

        window.addEventListener('resize', function () {
            var size = window.getComputedStyle(document.body, ':after').getPropertyValue('content');
            console.log(size)
            if (size == `"pc"`) {
                var nav_pc = document.getElementsByClassName("nav_pc")[0];
                nav_pc.style = "";
            }
        })

        var btn = function (e) {
            var u1 = document.getElementById(`u${e}`);
            var s1 = document.getElementById(`s${e}`);
            var displayStatus = getComputedStyle(u1).display;
            if (displayStatus == 'none') {
                s1.classList.add('arrows-active')
                u1.style.display = 'block';
            } else if (displayStatus == 'block') {
                s1.classList.remove('arrows-active')
                u1.style.display = 'none';
            }
        }

        function _showSade() {
            shade.style.display = "block";
        }

        function _closeSade() {
            shade.style.display = "none";
        }

        function showNav() {
            console.log(2);
            nav_pc.style.display = "block";
            _showSade();
        }

        function closeNav() {
            nav_pc.style = "";
            _closeSade();
        }
    </script>
</body>

</html>